<template>
	<view class="content">
		<view style="height: 40rpx;"></view>
		<scroll-view style="height: calc(100vh - 140rpx);padding: 30rpx 0;" class="wid90 bacFFF mar poRel" scroll-y="true">
			<!-- <view class="mar" style="width: 100rpx;height: 356rpx;">
				<image src="../../static/dingwei.png" class="wh100"></image>
			</view>
			<view style="height: 90rpx;"></view> -->
			<view class="wid80 hei80 coFFF fowe600 foSi35" style="padding-left: 30rpx;line-height: 70rpx;"
			:style="'box-sizing: border-box;background-size: 100% 100%;background-image: url('+imageUrl+'/draw_title.png);'">{{data.draw.num}}概述</view>
			<view class="wid90 mar mar-top20">
				<rich-text :nodes="data.draw.overview"></rich-text>
			</view>
			<view class="wid80 hei80 mar-top20 coFFF fowe600 foSi35" style="padding-left: 30rpx;line-height: 70rpx;"
			:style="'box-sizing: border-box;background-size: 100% 100%;background-image: url('+imageUrl+'/draw_title.png);'">{{data.draw.num}}吉凶解签</view>
			<view class="wid90 mar mar-top20">
				<rich-text :nodes="data.draw.lucky_inauspicious"></rich-text>
			</view>
			<view style="height: 140rpx;"></view>
		</scroll-view>
		<view class="wid100 poFix " style="bottom: 70rpx;">
			<view class="wid90 mar bacFFF">
				<view style="height: 20rpx;"></view>
				<view class="mar hei80 dis disAl disJuC borRad10 foSi35" @click="lianxi()"
					style="width: 428rpx;background-color: #C38D5F;">深入解读，请联系我们</view>
			</view>
		</view>
		<uni-popup ref="popup" type="center">
			<view style="width: 100vw;">
				<view v-if="data" class="bacFFF borRad10 wid90 mar poRel">
					<image src="../../static/guan.png" class="poAbs" @click="close()"
						style="top: 30rpx;right: 30rpx;width: 40rpx;height: 40rpx;"></image>
					<view style="height: 120rpx;"></view>
					<view class="wid90 mar dis disAl disJuB" >
						<image :src="ossurl+data.interpret[0]" mode="widthFix" style="width: 49%;"></image>
						<image :src="ossurl+data.interpret[1]" mode="widthFix" style="width: 49%;"></image>
					</view>
					<view class="textCen foSi30 fowe600 mar-top30" style="color: #8C8C8C;">扫二维码加好友</view>
					<view class="textCen foSi40 fowe600 mar-top30" >
						<view>手机：{{data.phone}}</view>
						<view>座机：{{data.tel}}</view>
					</view>
					<view style="height: 56rpx;"></view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url:this.global.url,
				ossurl:this.global.ossurl,
				id: '',
				data: '',
				imageUrl: this.global.imageUrl
			}
		},
		onLoad(option) {
			this.id = option.id
			this.qiuquan()
			this.alioss()
		},
		methods: {
			alioss(){
				var that  = this;
				uni.request({
				    // http://jufeng.tengshuokeji.cn//yonghu/order/order_comments
				    url: that.global.url + '/api/index/alioss',
				    method: "POST",
				    data: {},
				    success(res) {
				        let result = res.data
				        console.log(result)
				        if (result.code == 1) {
				            that.global.ossurl = result.data
							console.log(that.global.ossurl);
							that.ossurl = that.global.ossurl;
				        }
				    }
				})
			},
			qiuquan(){
				var that = this
				uni.request({
					url: that.global.url+'/api/Draw/detail', 
					data: {
						id: parseInt(that.id)
					},
					header: {
						 'Content-Type': 'application/json' ,//自定义请求头信息
						 'token':uni.getStorageSync('token')
					},
					method:'POST',//请求方式，必须为大写
					success: (res) => {
					    let result = res.data
					    if(result.code == 1){
							console.log(result.data);
							this.data = result.data
					    }else{
					        uni.showToast({
					            title: result.msg,
					            icon:'none',
								duration: 2000
					        })
					    }
					}
				})
				
			},
			close(){
				this.$refs.popup.close()
			},
			lianxi(){
				this.$refs.popup.open()
			},
			tiaozhuan(url){
				uni.navigateTo({
					url: url
				})
			},
		},
		filters: {
			formatDate(value) {
				let date = new Date(value * 1000);
				//时间戳为10位需*1000，时间戳为13位的话不需乘1000
				let y = date.getFullYear();
				let MM = date.getMonth() + 1;
				MM = MM < 10 ? ('0' + MM) : MM; //月补0
				let d = date.getDate();
				d = d < 10 ? ('0' + d) : d; //天补0
				let h = date.getHours();
				h = h < 10 ? ('0' + h) : h; //小时补0
				let m = date.getMinutes();
				m = m < 10 ? ('0' + m) : m; //分钟补0
				let s = date.getSeconds();
				s = s < 10 ? ('0' + s) : s; //秒补0
				return y + '-' + MM + '-' + d; //年月日
				// return y + '-' + MM + '-' + d + ' ' + h + ':' + m+ ':' + s; //年月日时分秒
		
			}
		}
	}
</script>

<style>
	.content {
		height: 100vh;
		background-color: #F4EDDD;
	}
	.xq{
		background-color: #C38D5F;
		width: 130rpx;
		height: 50rpx;
	}
	.xq1{
		border: 1rpx solid #C38D5F;
		color: #C38D5F;
		width: 130rpx;
		height: 50rpx;
	}
	.xia{
		background-color: #E5E5E5;
		height: 1rpx;
	}
</style>